#pragma once
#include "Dispatcher.h"
#include <sys/epoll.h>

class EpollDispatcher : public Dispatcher
{
public:
    EpollDispatcher(EventLoop *evLoop);
    ~EpollDispatcher();
    // 添加
    int32_t add() override;
    // 删除
    int32_t remove() override;
    // 修改
    int32_t modify() override;
    // 事件检测 2s
    int32_t dispatch(int timeout = 2) override;

private:
    int32_t epollCtl(int8_t optional);
private:
    int32_t m_epfd;
    struct epoll_event *m_events;
    const int m_maxNode = 520;
};
